package kdiaz.spring.bibliotecaweb.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import kdiaz.spring.bibliotecaweb.model.Person;
import kdiaz.spring.bibliotecaweb.service.PersonService;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 *
 * @author kdiaz
 */
public class LoginController implements Controller {

    private PersonService personService;

    public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws Exception {
        List<Person> people = personService.getPeople();
        return new ModelAndView("login", "people", people);
    }

    public void setPersonService(PersonService personService) {
        this.personService = personService;
    }
}
